window.onload=function(){
    var mainBody=document.getElementById('mainBody');
    var mainBodyLi=mainBody.getElementsByTagName('li');
    var frame=document.getElementById('frame');
    var frameTwo=document.getElementById('frameTwo');
    var arr=new Array(
        "page1.html","page2.html","page3.html","page4.html","page5.html"
    );
    var arr2=new Array(
        "xueshengxueji.html","addStudent.html"
    );
    for(var i=0;i<mainBodyLi.length;i++)
    {
        mainBodyLi[i].index=i;
        mainBodyLi[i].onclick=function () {
            for(var j=0;j<mainBodyLi.length;j++)
            {
                mainBodyLi[j].style.background="#DDDDDD";
            }
            this.style.background="red";
            if(frame){
                frame.src=arr[this.index];
            }
            else if(frameTwo){
                frameTwo.src=arr2[this.index];
            }

        }
    }
};







/*
var right=document.getElementsByClassName('right');
for(var i=0;i<mainBody.length;i++)
{
    mainBody[i].index=i;
    mainBody[i].onclick=function(){
        for(var j=0;j<mainBody.length;j++)
        {
            mainBody[j].style.background='#DDDDDD';
            right[j].style.display='none';
            mainBody[j].style.color="black";
        }
        this.style.background='red';
        this.style.color="white";
        right[this.index].style.display='inline-block';
    };
}*/
